package com.luban.springboot.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.luban.springboot.pojo.User;

@Controller
public class UserController {
	
	@RequestMapping(value ="/userList")
	public String userList(ModelMap model) {
		//模拟用户
		User user1 = new User(1,"小班友",20,"男");
		User user2 = new User(2,"小书包",25,"女");
		User user3 = new User(3,"小牛牛",30,"男");
		User user4 = new User(4,"小鱼鱼",35,"女");
		
		//将所有用户放入集合
		List<User> users = new ArrayList<>();
		users.add(user1);
		users.add(user2);
		users.add(user3);
		users.add(user4);
		
		model.addAttribute("userList", users);
		return "list";
	}
}
